<?php
/*
  $Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

// check if the 'install' directory exists, and warn of its existence
  if (WARN_INSTALL_EXISTENCE == 'true') {
    if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) {
      $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');
    }
  }

// check if the configure.php file is writeable
  if (WARN_CONFIG_WRITEABLE == 'true') {
    if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) {
      $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');
    }
  }

// check if the session folder is writeable
  if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {
    if (STORE_SESSIONS == '') {
      if (!is_dir(tep_session_save_path())) {
        $messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');
      } elseif (!is_writeable(tep_session_save_path())) {
        $messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');
      }
    }
  }

// check session.auto_start is disabled
  if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {
    if (ini_get('session.auto_start') == '1') {
      $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');
    }
  }

  if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {
    if (!is_dir(DIR_FS_DOWNLOAD)) {
      $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');
    }
  }

  if ($messageStack->size('header') > 0) {
    echo $messageStack->output('header');
  }

// get flag
$flag_image = '';
$flag_title = 'Top Oximetery, Stethoscope, ECG, Fetal Doppler Monitors Distributor ';
$flag_query = tep_db_query("SELECT *  FROM " . TABLE_CURRENCIES_INFO . " WHERE code =  '" . $currency . "'");
$flag_count = tep_db_num_rows($flag_query);
if ($flag_count == 1)
{
	$flag = tep_db_fetch_array($flag_query);
	$flag_image = $flag['flag'];
	$flag_title .= $flag['country'];
}
?>

<script type="text/javascript" src="includes/tuin.js"></script>
<script language="JavaScript" type="text/javascript">
<!-- Copyright 2003, Sandeep Gangadharan -->
<!-- For more free scripts go to http://www.sivamdesign.com/scripts/ -->
<!-- 
var timerCount = 0;
function sivamtime() {
	var now = new Date();
	now.setSeconds(now.getSeconds() + timerCount);

	hour=now.getHours();
	min=now.getMinutes();
	sec=now.getSeconds();

	if (min<=9) { min="0"+min; }
	if (sec<=9) { sec="0"+sec; }
	if (hour>12) { hour=hour-12; add="pm"; }
	else { hour=hour; add="am"; }
	if (hour==12) { add="pm"; }

	time = ((hour<=9) ? "0"+hour : hour) + ":" + min + ":" + sec + " " + add;

	if (document.getElementById) { document.getElementById('theTime').innerHTML = time; }
	else if (document.layers) {
		document.layers.theTime.document.write(time);
		document.layers.theTime.document.close(); 
	}

	setTimeout("sivamtime(timerCount)", 1000);
	timerCount++;
}

window.addEventListener('load', sivamtime, true);
</script>

<?php
// detect client's browser's window size and resolution.
	$callget_res_page_name = $REQUEST_URI;
	$GLOBALS['callget_res_page_name'] = $callget_res_page_name;
	include(DIR_WS_INCLUDES . "get_resolution.php");
	if ($screen_width >= 1000)
	{$maintable_width = '1000';}
	else
	{$maintable_width = '100%';}
?>
<link rel="stylesheet" type="text/css" href="stylesheet_list.css" />
<table border="0" width="<?php echo $maintable_width;?>" cellspacing="0" cellpadding="0">
  <tr class="header">
    <td valign="middle">
		<?php 
			if($request_type == 'NONSSL') 
			{echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'site_logo.gif', $flag_title, 240) . '</a>'; }
			else
			{echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'site_logo_SSL.gif', $flag_title, 200, 70) . '</a>'; }
			echo '&nbsp;&nbsp;&nbsp;';
			if(tep_session_is_registered('master_password'))
			{echo tep_image(DIR_WS_IMAGES . 'Lowest_Price_Promise.gif', $flag_title);}
		?>
		</td>
    <td align="right" valign="bottom">
			<table border="0" width="50%" cellspacing="0" cellpadding="1">
				<tr>
					<td align="right" valign="top" class="smallText" nowrap>
				<?php
				if($currency == 'USD') 
				{
					//echo tep_image(DIR_WS_IMAGES . 'tollfree.gif', '1.888.7.MyGuard (1.888.769.4827)');
				}//endif
				?>
				<? //---PayPal WPP Modification START ---// ?>
				<?php 
					if (tep_session_is_registered('customer_id')) {
						$show_user_options = true;
						if (tep_paypal_wpp_enabled() && tep_session_is_registered('paypal_ec_temp')) {
							//If this is a temp account that'll be deleted, don't show account information
							if ($paypal_ec_temp) {
								$show_user_options = false;
							}
						}
					} else {
						$show_user_options = false;
					}  
				?>  
				<?php 
				if ($screen_width >= 1000)
				{
				?>
						<a href="<?php echo tep_href_link(FILENAME_CUSTOMERSERVICE);?>" class="site_theme_underline"><?php echo BOX_INFORMATION_CUSTOMERSERVICE;?></a> &nbsp;
				<?php
				}
				?>
						<?php 
						if ($show_user_options) { 
						?>
						<a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="site_theme_underline"><?php echo HEADER_TITLE_LOGOFF; ?></a> &nbsp;
						<?php } ?>
						<a href="<?php echo tep_href_link(FILENAME_ORDER_STATUS, '', 'SSL'); ?>" class="site_theme_underline"><?php echo HEADER_TITLE_ORDER_STATUS; ?></a> &nbsp;<a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="site_theme_underline"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> &nbsp;
				<? //---PayPal WPP Modification END ---// ?>
					</td>
					<?php if($request_type == 'NONSSL') {?>
						<td align="right" valign="top" class="smallText" nowrap rowspan="2">
						<?php require(DIR_WS_BOXES . 'shopping_cart_mini.php');?>
						</td>
					<?php } ?>
				</tr>
				<tr>
					<td align="right" valign="bottom" nowrap>

	<!--<a href="/livehelp/index.php" target="_blank" onclick="openLiveHelp(); return false"><img src="/livehelp/include/status.php" id="LiveHelpStatus" name="LiveHelpStatus" border="0" alt="Live Assistance" title="Live Assistance" onload="statusImagesLiveHelp[statusImagesLiveHelp.length] = this;"/></a>-->
<?php
		//echo tep_image(DIR_WS_IMAGES . 'divider_icons.gif', $flag_title) . '&nbsp;';
?>

		<?php
		if (!empty($flag_image)) 
		{
			echo tep_image(DIR_WS_IMAGES . $flag_image, $flag_title). '&nbsp;';
		} 
		?>
					</td>
				</tr>
			</table>
		</td>
  </tr>
</table>
<table border="0" width="<?php echo $maintable_width;?>" cellspacing="0" cellpadding="1">
  <tr class="headerNavigation">
    <td class="headerNavigation" colspan="2">&nbsp;&nbsp;<?php echo $breadcrumb->trail(' &raquo; '); ?></td>
  </tr>
	<tr>
		<td class="headerNavigationSearch" align="left" valign="middle" nowrap><?php echo  tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_image_button('header_search.gif', '', 'align="absmiddle"') . tep_draw_input_field('keywords', '', 'size="150" maxlength="30" style="width: ' . (BOX_WIDTH + 50) . 'px" align="absmiddle"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description','1') . ' ' . tep_image_submit('header_search_go.gif', IMAGE_BUTTON_SEARCH, 'align="absmiddle"') . '</form>'; ?></td>

		<td class="headerNavigationSearch" align="right" valign="middle" width="5%" nowrap><?php echo HEAD_SPECIAL_INFO;?></td>
	</tr>
</table>
<?php
  if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) {
?>
<table border="0" width="<?php echo $maintable_width;?>" cellspacing="0" cellpadding="2">
  <tr class="headerError">
    <td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td>
  </tr>
</table>
<?php
  }

  if (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) {
?>
<table border="0" width="<?php echo $maintable_width;?>" cellspacing="0" cellpadding="2">
  <tr class="headerInfo">
    <td class="headerInfo"><?php echo htmlspecialchars($HTTP_GET_VARS['info_message']); ?></td>
  </tr>
</table>
<?php
  }
flush(); // Flush the output buffer

// register referrer_query_string only once
if (!tep_session_is_registered('referrer_query_string')) {		
    tep_session_register('referrer_query_string');
		$referrer_query_string =  $tracker->get_referrer_query_string();
}
?>

